const KoaRouter = require('koa-router');

const momentRouter = new KoaRouter({prefix: '/moment'});

const {
  verifyAuth,
  verifyPermission
} = require('../middleware/auth.middleware');

const {
  publishMoment,
  getMoment,
  getMoments,
  changeMoment,
  removeMoment
} = require('../controller/moment.controller');

// 发表动态
momentRouter.post('/publish', verifyAuth, publishMoment);
// 获取动态（单个）
momentRouter.post('/:momentId', verifyAuth, getMoment);
// 获取动态（多个）
momentRouter.get('/', getMoments);
// 修改动态
momentRouter.patch('/:momentId', verifyAuth, verifyPermission, changeMoment);
// 删除动态
momentRouter.delete('/:momentId', verifyAuth, verifyPermission, removeMoment);

module.exports = momentRouter;